//
//  MYGAcademicConferenceInteractToolBar.swift
//  MYDoctor
//
//  Created by Denny on 2024/5/28.
//

import UIKit

class MYGAcademicConferenceInteractToolBar: UIView {
    var tapCompletion:(()->Void)?
    var lineBottom: UIView = {
        let control = UIView()
        control.backgroundColor = UIColor.init(hexString: "eeeeee")
        return control
    }()
    
    var icon:UIImageView = {
        let control = UIImageView()
        control.layer.cornerRadius = 14
        control.layer.masksToBounds = true
        control.sd_setImage(with: URL(string: MYGUserManager.getUser()?.doctor.avatar), placeholderImage: UIImage.init(named: "head"), context: nil)
        return control
    }()
    
    var titleLB:UILabel = {
        let control = UILabel()
        control.text = "我来提问"
        control.font = .regular(13)
        control.textColor = UIColor.init(hexString: "333333")
        return control
    }()
    override init(frame: CGRect) {
        super.init(frame: frame)
        addSubview(lineBottom)
        lineBottom.snp.makeConstraints { make in
            make.left.top.right.equalToSuperview()
            make.height.equalTo(1)
        }
        addSubview(icon)
        icon.snp.makeConstraints { make in
            make.size.equalTo(CGSize.init(width: 28, height: 28))
            make.top.equalToSuperview().offset(10)
            make.left.equalToSuperview().offset(19)
        }
        
        addSubview(titleLB)
        titleLB.snp.makeConstraints { make in
            make.centerY.equalTo(icon.snp.centerY)
            make.left.equalTo(icon.snp.right).offset(12)
        }
        let tap = UITapGestureRecognizer(target: self, action: #selector(tapAction(_:)))
        self.addGestureRecognizer(tap)
    }
    
    @objc func tapAction(_ sender:UIGestureRecognizer){
        if let c = tapCompletion {
            c()
        }
    }
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
}
